﻿using Common;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SystemEntity;
using SystemRepository;

namespace SystemService
{
    public class ActionLogService : IScoped
    {
        private readonly ILogger<ActionLogService> _logger;

        private ActionLogRepository _actionLogRepository = null;
        public ActionLogService(ActionLogRepository actionLogRepository, ILogger<ActionLogService> logger)
        {
            _logger = logger;
            _actionLogRepository = actionLogRepository;
        }
        public void AddLog(ActionLogEntity entity) 
        {
            _actionLogRepository.Insert(entity);
        }
        public void UpdateLog(ActionLogEntity entity) 
        {
            _actionLogRepository.Update(entity);
        }
        public ActionLogEntity First(string id) 
        {
            return _actionLogRepository.FirstOrDefault(t => t.RequestId == id);
        }
    }
}
